package com.woniuxy.service.serviceImpl;

import com.woniuxy.dao.UserDao1;
import com.woniuxy.entity.User;
import com.woniuxy.service.UserService;

import java.util.List;

/**
 * @author: ideaAdmin
 * Date: 2022/1/19:15:35
 * Description:
 */

public class UserServiceImpl implements UserService {
    UserDao1 userDao;

    public UserServiceImpl() {
    }

    public UserServiceImpl(UserDao1 userDao) {
        this.userDao = userDao;
    }

    public void setUserDao(UserDao1 userDao) {
        this.userDao = userDao;
    }

    @Override
    public List<User> findAll(Integer id) {
        return userDao.findAll(id);
    }

    @Override
    public User insertUser(User user) {
        if (userDao.insertUser(user) > 0) {
            return user;
        }
        return null;
    }
    //根据id更改用户状态
    @Override
    public boolean updateUser(User user) {

        return userDao.updateUser(user) > 0;
    }

    //根据id删除id
    @Override
    public boolean delById(User user) {
        return userDao.delById(user) > 0;
    }


}
